package com.seveneight.baijiesteward.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.seveneight.baijiesteward.R;
import com.seveneight.baijiesteward.bean.ProfitBean;
import com.seveneight.baijiesteward.utils.DateUtil;
import com.seveneight.baijiesteward.utils.StringFormat;

/**
 * Created by user1 on 2018/4/4.
 */

public class ProfitAdapter extends ListBaseAdapter<ProfitBean> {


    public ProfitAdapter(Context context) {
        super(context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_record;
    }

    @Override
    public void onBindItemHolder(SuperViewHolder holder, int position) {
        TextView tv_type = holder.getView(R.id.tv_type);
        TextView tv_amount = holder.getView(R.id.tv_amount);
        TextView tv_date = holder.getView(R.id.tv_date);
        tv_date.setVisibility(View.GONE);
        TextView tv_states = holder.getView(R.id.tv_states);
        ProfitBean profitBean = mDataList.get(position);
        tv_type.setText(profitBean.getSourceOrderNo());
        tv_amount.setText("+" + StringFormat.formatNumber(profitBean.getProfitAmount()));
        tv_states.setText(DateUtil.formatDate(profitBean.getProfitTime()));
        switch (profitBean.getProfitType()) {
            case 40:
                tv_type.setText("一级流水分润");
                break;
            case 41:
                tv_type.setText("二级流水分润");
                break;
            case 42:
                tv_type.setText("三级流水分润");
                break;
            case 50:
                tv_type.setText("一级裂变收益");
                break;
            case 51:
                tv_type.setText("二级裂变收益");
                break;
            case 52:
                tv_type.setText("三级裂变收益");
                break;
        }
    }
}
